package com.example.myapplication8.ui.settings

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class SettingsViewModel : ViewModel() {
    // 通知设置
    private val _notificationsEnabled = MutableLiveData<Boolean>().apply {
        value = true // 默认开启通知
    }
    val notificationsEnabled: LiveData<Boolean> = _notificationsEnabled

    // 主题设置
    private val _currentTheme = MutableLiveData<Int>().apply {
        value = THEME_SYSTEM // 默认跟随系统
    }
    val currentTheme: LiveData<Int> = _currentTheme

    // 语言设置
    private val _currentLanguage = MutableLiveData<String>().apply {
        value = "zh" // 默认中文
    }
    val currentLanguage: LiveData<String> = _currentLanguage

    // 更新通知设置
    fun updateNotificationSettings(enabled: Boolean) {
        _notificationsEnabled.value = enabled
    }

    // 更新主题设置
    fun updateTheme(theme: Int) {
        _currentTheme.value = theme
    }

    // 更新语言设置
    fun updateLanguage(language: String) {
        _currentLanguage.value = language
    }

    companion object {
        const val THEME_LIGHT = 0
        const val THEME_DARK = 1
        const val THEME_SYSTEM = 2
    }
}